package com.bckj.freshnow.payment.pay.ons.producer;

import com.aliyun.openservices.ons.api.Message;
import com.aliyun.openservices.ons.api.bean.ProducerBean;
import com.bckj.fastboot.core.jackson.JsonUtils;
import com.bckj.fastboot.mq.ons.AbstractOnsProducer;
import com.bckj.freshnow.common.constant.PaymentMQConstants;
import com.bckj.freshnow.payment.model.PayResultMsg;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
public class PayResultOnsProducer extends AbstractOnsProducer<PayResultMsg> {

    private final ProducerBean producer;

    @Override
    public ProducerBean getProducer() {
        return producer;
    }

    @Override
    protected Message buildMessage(PayResultMsg msg) {
        return new Message(PaymentMQConstants.TOPIC, PaymentMQConstants.TAG_RESULT, JsonUtils.toJsonStr(msg).getBytes());
    }
}
